{template 'common/header'}
<div class='container' style='padding:0 5px 10px;margin:0;width:100%'>
	<ul class="nav nav-tabs">
	  <li {if $op == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('article', array('op' => 'post'));}">添加文章</a></li>
	  <li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('article',array('op'=>'display'));}">管理文章</a></li>
	</ul>
	{if $op =='display'}
		<div class="panel panel-success">
		  <div class="panel-heading">常用工具 > 文章列表</div>
		</div>
		<form id="form2" class="form-horizontal" action="{php echo $this->createWebUrl('article', array('op' => 'del'));}" method="post">
			<table class="table table-hover">
				<thead class="navbar-inner">
					<tr>
						<th style="width:40px;">全选</th>
	          			<th style="width:80px;text-align:center;">序号</th>
	          			<th style="width:200px;text-align:center;">标题</th>
	          			<th style="width:200px;text-align:center;">特色图片</th>
	          			<th style="width:200px;text-align:center;">发布时间</th>
	          			<th style="width:70px;text-align:center;">置顶</th>
						<th style="min-width:80px;width:80px;text-align:center;">操作</th>
					</tr>
				</thead>
				<tbody>
					{loop $list $item}
					<tr>
						<td><input type="checkbox" value="{$item['id']}" name="delete[]"></td>
						<td style="text-align:center;">{$item['id']}</td>
						<td style="text-align:center;">{$item['title']}</td>
						<td style="text-align:center;"><img src="{$_W['attachurl']}{$item['images']}" style="width:100px"></td>
						<td style="text-align:center;">{php echo date("Y-m-d H:m:s",$item['add_time'])}</td>
						<td style="text-align:center;"><?php if($item['is_stick'] == "1"){echo "是";}else{echo "否";}?></td>
						<td style="text-align:center;">
						<a href="{php echo $this->createWebUrl('article', array('op' => 'post', 'id' => $item['id']))}" title="编辑" class="btn btn-xs btn-primary"><span class="icon icon-compose">编辑</span></a>						
						<a onclick="if(confirm('此操作不可恢复，确认吗？')){location.href='{php echo $this->createWebUrl('article', array('id' => $item['id'],'op'=>'del'))}'}" href="javascript:;" title="删除" class="btn btn-xs btn-danger"><span class="icon icon-close">删除</span></a>						
						</td>				
					</tr>
					{/loop}
					<tr >
						<td><input type="checkbox"  onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" name=''>
							<input class="btn btn-primary btn-xs" type="submit" value="删除" name="submit" >
						</td>
						<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
					</tr>
				</tbody>
			</table>
			<input type="hidden" value="article" name="do">
			<input type="hidden" value="del" name="op">
			<input type="hidden" name="token" value="{$_W['token']}" />
		</form>
		{$pager}		
		<script>
			$('#form2').submit(function(){
				if($(":checkbox[name='delete[]']:checked").size() > 0){
					return confirm('删除后不可恢复，您确定删除吗？');
				}
				return false;
			}); 
		</script>	
	</div>
	{elseif $op == 'post'}
	<div class="panel panel-success">
	    <div class="panel-heading">常用工具 > 添加/修改文章</div>
	</div>
	<div class="main">
		<form action="" method="post" class="form-horizontal form">
			<div class="panel panel-default">	
				<div class="panel-body">
					
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">文章标题</label>
						<div class="col-sm-8">
							<input type="text" name="title" class="form-control" value="{$item['title']}" />
							<span class="help-block"></span>
						</div>
					</div>	

					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">特色图片</label>
						<div class="col-sm-8">
							{php echo tpl_form_field_image('images',$item['images']);}
							<span class="help-block"></span>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">内容简介</label>
						<div class="col-sm-8">
							<input type="text" name="short" class="form-control" value="{$item['short']}" />
							<span class="help-block"></span>
						</div>
					</div>
										
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">文章内容</label>
						<div class="col-sm-8">
							{php echo tpl_ueditor('content', $item['content']);}
							<span class="help-block"></span>
						</div>
					</div>
									    			        
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">置顶</label>
						<div class="col-sm-8">
							<input name="is_stick" type="radio" value="1" <?php if($item['is_stick']=="1"){?>checked="checked"<?php }?>/> 是 &nbsp;&nbsp;&nbsp;&nbsp;
							<input name="is_stick" type="radio" value="0" <?php if($item['is_stick']=="0"){?>checked="checked"<?php }?>/> 否
							<span class="help-block"></span>
						</div>
					</div>
					
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label"></label>
						<div class="col-sm-4">
							<input type="hidden" name="id" value="{$item['id']}">
							<input type="hidden" name="token" value="{$_W['token']}" />
							<input name="submit" type="submit" value="提交" class="btn btn-primary span3" />
						</div>
					</div>	
				</div>
			</div>
		</form>
	</div>
{/if}		
</div>
{template 'common/footer'}
